package com.learn.sunday.common.service;

import lombok.Data;

@Data
public class ResponseUtil {

    private Integer code;

    private String msg;

    private Object data;


    public static ResponseUtil success(){
        ResponseUtil response = new ResponseUtil();
        response.setCode(200);
        response.setMsg("success");
        return response;
    }

    public static ResponseUtil failure(){
        ResponseUtil response = new ResponseUtil();
        response.setCode(502);
        response.setMsg("success");
        return response;
    }

    public ResponseUtil code(int code){
        this.setCode(code);
        return this;
    }

    public ResponseUtil data(Object data){
        this.data = data;
        return this;
    }

    public ResponseUtil msg(String msg){
        this.msg = msg;
        return this;
    }
}
